export function setCookie(key, value, seconds, path = '/'){
    var date=new Date()
    date.setTime(date.getTime() -8*3600*1000 + seconds * 1000)
    document.cookie = key + '=' +value+ ';expires=' +date+ ';path=' + path
}

export function getCookie(key){
    var cookies = document.cookie
    if(!cookies) return
    var arr = cookies.split('; ')
    for(var a=0; a<arr.length; a++){
        var brr = arr[a].split('=')
        if(brr[0] === key){
            return brr[1]
        }
    }
}

export function removeCookie(key, path='/'){
    setCookie(key, null, -1, path)
}